Skip to content

Conversation

@luancazarine
Copy link
Collaborator

@luancazarine luancazarine commented Nov 28, 2025

Resolves #19270

Summary by CodeRabbit

  • New Features

    • Enhanced availability search with extensive filters (dates, stay/arrival rules, guest counts, amenities, pricing, property/rentable type, countries, promotions) and advanced sorting/limiting options
    • Field selection and result customization for rentable-type queries; optional multibook safety margin
    • New selectors for rentable segments, amenities, and discount campaigns
  • Chores

    • Package and action version bumps across the component set

✏️ Tip: You can customize this high-level summary in your review settings.

@luancazarine luancazarine linked an issue Nov 28, 2025 that may be closed by this pull request
@vercel
Copy link

vercel bot commented Nov 28, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Dec 4, 2025 6:14pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Dec 4, 2025 6:14pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2025

Walkthrough

Expands Booking Experts actions with many optional filters, sorters, and limiters for availabilities and rentable-type availabilities; adds constants, a parse utility, new app propDefinitions and list endpoints; and bumps component package and several action/source versions.

Changes

Cohort / File(s) Summary
Availabilities action
components/booking_experts/actions/list-availabilities/list-availabilities.mjs
Imports LIMITERS_OPTIONS, SORTERS_OPTIONS, WEEKDAY_OPTIONS, parseObject. Bumps version to 0.0.4. Adds ~40+ new public props (fields, include, channels, date filters, arrangement, LOS, weekdays, administration/rentable/amenity filters, guest counts, pricing, bedroom/bed/shower/etc counts, sorters, limiter controls, and many limit/offset toggles). Run now builds a comprehensive params object mapping all props (including nested filter/sorter/limiter structures) to this.bookingExperts.listAvailabilities.
Rentable-type availabilities action
components/booking_experts/actions/list-rentabletype-availabilities/list-rentabletype-availabilities.mjs
Imports FIELDS_OPTIONS and parseObject. Bumps version to 0.0.4. Adds public props: fields (string[]), include (string[]), multibookSafetyMargin (integer). Runtime now parses/joins fields and include and passes multibook_safety_margin into API params.
App propDefinitions & endpoints
components/booking_experts/booking_experts.app.mjs
Adds propDefinitions: rentableSegmentId, amenityId, discountCampaignId with async options. Adds methods: listRentableSegments(opts), listAmenities(opts), listDiscountCampaigns(administrationId, ...opts) that call respective API paths and map results to { label, value }.
Constants
components/booking_experts/common/constants.mjs
Adds exported constants: FIELDS_OPTIONS, LIMITERS_OPTIONS, SORTERS_OPTIONS, WEEKDAY_OPTIONS.
Utilities
components/booking_experts/common/utils.mjs
Adds exported parseObject(obj) which gracefully attempts JSON.parse on strings/array items, returns undefined for falsy input, and falls back to original values on parse failure.
Package version
components/booking_experts/package.json
Package version bumped from 0.3.2 to 0.4.0.
Action/source version bumps
multiple files: components/booking_experts/actions/*, components/booking_experts/sources/*
Multiple actions and sources have only version increments (examples: add-guest-to-reservation 0.0.6→0.0.7, create-agenda-period 0.0.5→0.0.6, get-reservation 0.0.2→0.0.3, several others). No behavioral changes reported.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Verify complete and correct mapping of all newly added props in list-availabilities to API parameter names and nested structures (filters, sorters, limiters).
  • Inspect parseObject behavior with arrays and strings (edge cases, invalid JSON, non-string items).
  • Validate list-rentabletype-availabilities parsing/joining logic for fields and include.
  • Review new app methods (listRentableSegments, listAmenities, listDiscountCampaigns) for correct endpoints, pagination usage, and response mapping.
  • Confirm constants (LIMITERS_OPTIONS, SORTERS_OPTIONS, WEEKDAY_OPTIONS, FIELDS_OPTIONS) values match API expected keys.

Possibly related PRs

Suggested labels

User submitted

Suggested reviewers

  • GTFalcao
  • michelle0927

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the main change: expanding filters for availabilities and rentable type availabilities in Booking Experts.
Description check ✅ Passed The PR description correctly references the linked issue #19270 that details the filtering expansion requirements.
Linked Issues check ✅ Passed The PR comprehensively implements the requirements from #19270: both GET availabilities and GET rentable_type availabilities endpoints now expose all optional filtering parameters.
Out of Scope Changes check ✅ Passed All changes are scoped to expanding filters for the two requested endpoints; version bumps and supporting constants/utilities are directly related to implementing the new filters.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 19270-action-booking-experts---expand-filters

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce189ad and ce7dde5.

📒 Files selected for processing (5)
  • components/booking_experts/actions/list-availabilities/list-availabilities.mjs (2 hunks)
  • components/booking_experts/actions/list-rentabletype-availabilities/list-rentabletype-availabilities.mjs (3 hunks)
  • components/booking_experts/booking_experts.app.mjs (2 hunks)
  • components/booking_experts/common/constants.mjs (1 hunks)
  • components/booking_experts/common/utils.mjs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
components/booking_experts/actions/list-rentabletype-availabilities/list-rentabletype-availabilities.mjs (3)
components/booking_experts/common/constants.mjs (2)
  • FIELDS_OPTIONS (1-12)
  • FIELDS_OPTIONS (1-12)
components/booking_experts/actions/list-availabilities/list-availabilities.mjs (1)
  • parseObject (464-536)
components/booking_experts/common/utils.mjs (2)
  • parseObject (1-24)
  • parseObject (1-24)
components/booking_experts/actions/list-availabilities/list-availabilities.mjs (2)
components/booking_experts/common/constants.mjs (6)
  • WEEKDAY_OPTIONS (80-109)
  • WEEKDAY_OPTIONS (80-109)
  • SORTERS_OPTIONS (37-78)
  • SORTERS_OPTIONS (37-78)
  • LIMITERS_OPTIONS (14-35)
  • LIMITERS_OPTIONS (14-35)
components/booking_experts/common/utils.mjs (2)
  • parseObject (1-24)
  • parseObject (1-24)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Lint Code Base
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (6)
components/booking_experts/common/utils.mjs (1)

1-24: LGTM!

The parseObject utility handles various input types robustly with appropriate try/catch guards for JSON parsing failures. The function gracefully falls back to the original value when parsing fails, which is the correct behavior for this use case.

components/booking_experts/booking_experts.app.mjs (1)

462-481: LGTM!

The new API methods follow the established patterns consistently and correctly delegate to _makeRequest with appropriate paths.

components/booking_experts/common/constants.mjs (1)

1-109: LGTM!

Constants are well-structured with clear labels. The weekday values correctly follow the standard convention (0=Sunday through 6=Saturday).

components/booking_experts/actions/list-rentabletype-availabilities/list-rentabletype-availabilities.mjs (2)

72-92: LGTM!

The run method correctly builds the params object with optional fields. The use of parseObject and optional chaining ensures graceful handling of undefined values.


52-58: Remove this review comment — the core premise is incorrect.

The FIELDS_OPTIONS constant is not shared with the list-availabilities action. The list-availabilities.mjs file does not import or use FIELDS_OPTIONS at all; its fields parameter has no predefined options. These are separate endpoints with different implementations: list-availabilities queries the general availabilities endpoint, while list-rentabletype-availabilities queries the rentable_type_availability endpoint and appropriately provides field options specific to that context.

Likely an incorrect or invalid review comment.

components/booking_experts/actions/list-availabilities/list-availabilities.mjs (1)

463-539: Overall implementation approach is sound.

The comprehensive params object construction with parseObject and optional chaining handles the many optional filters appropriately. The structure aligns well with the PR objective of expanding filter support.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
components/booking_experts/actions/list-inventory-objects/list-inventory-objects.mjs (1)

53-55: Consider using parseObject utility for labels serialization.

The PR context mentions a new parseObject utility introduced in shared constants. Currently, the code manually joins labels with a comma. If parseObject is the standard way to serialize complex fields in this PR, apply it here for consistency.

Please confirm whether labels should use:

-"filter[labels]": this.labels
-  ? this.labels.join(",")
-  : undefined,
+"filter[labels]": this.labels
+  ? parseObject(this.labels)
+  : undefined,

(or similar, depending on the intended signature of parseObject)

components/booking_experts/actions/list-bookings/list-bookings.mjs (1)

67-77: Channel filter uses undefined prop; created/updated filters have no props

In the params object:

  • "filter[channel]" uses this.listAdministrationChannels, but there is no listAdministrationChannels prop defined. The available prop is administrationChannelId (Line 32). As written, the channel filter is never actually applied.
  • "filter[created_at]" and "filter[updated_at]" reference this.createdAt and this.updatedAt, but there are no corresponding props, so these filters are effectively dead code.

This breaks the advertised “Filter by channel” behavior and leaves the created/updated filters in a half‑wired state.

Consider updating the action like this:

    const { data } = await this.bookingExperts.listBookings({
      $,
      administrationId: this.administrationId,
      params: {
        "filter[owner]": this.ownerId,
-        "filter[channel]": this.listAdministrationChannels,
-        "filter[reservations]": this.reservationId,
-        "filter[created_at]": this.createdAt,
-        "filter[updated_at]": this.updatedAt,
+        "filter[channel]": this.administrationChannelId,
+        "filter[reservations]": this.reservationId,
+        // If you intend to support these, add corresponding props to `props`:
+        // "filter[created_at]": this.createdAt,
+        // "filter[updated_at]": this.updatedAt,
        "page[number]": this.page,
        "page[size]": this.perPage,
      },
    });

If createdAt / updatedAt filters should be user-configurable, also add explicit props for them to the props section; otherwise, remove those params entirely to avoid confusion.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce7dde5 and 31fbd5e.

📒 Files selected for processing (15)
  • components/booking_experts/actions/add-guest-to-reservation/add-guest-to-reservation.mjs (1 hunks)
  • components/booking_experts/actions/create-agenda-period/create-agenda-period.mjs (1 hunks)
  • components/booking_experts/actions/delete-guest/delete-guest.mjs (1 hunks)
  • components/booking_experts/actions/get-booking/get-booking.mjs (1 hunks)
  • components/booking_experts/actions/get-complex-prices/get-complex-prices.mjs (1 hunks)
  • components/booking_experts/actions/get-reservation/get-reservation.mjs (1 hunks)
  • components/booking_experts/actions/list-bookings/list-bookings.mjs (1 hunks)
  • components/booking_experts/actions/list-inventory-objects/list-inventory-objects.mjs (1 hunks)
  • components/booking_experts/actions/list-reservations/list-reservations.mjs (1 hunks)
  • components/booking_experts/actions/search-contacts/search-contacts.mjs (1 hunks)
  • components/booking_experts/actions/update-guest/update-guest.mjs (1 hunks)
  • components/booking_experts/sources/booking-updated/booking-updated.mjs (1 hunks)
  • components/booking_experts/sources/inventory-object-updated/inventory-object-updated.mjs (1 hunks)
  • components/booking_experts/sources/new-booking-created/new-booking-created.mjs (1 hunks)
  • components/booking_experts/sources/new-inventory-object-created/new-inventory-object-created.mjs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (14)
components/booking_experts/sources/new-booking-created/new-booking-created.mjs (1)

8-8: Version bump looks consistent with broader Booking Experts changes

The version increment to 0.0.4 matches the pattern of PR-wide version bumps for Booking Experts components and doesn’t alter runtime behavior for this source. As long as any external references (docs, templates, or catalog metadata) expect the new version, this is good to go.

components/booking_experts/sources/inventory-object-updated/inventory-object-updated.mjs (1)

8-8: Verify scope: version bump appears misaligned with PR objectives.

This file handles inventory object updates, but the PR objectives specifically request expanding filters for availability endpoints (GET availabilities and GET rentable_type availabilities). The version bump to "0.0.4" lacks accompanying functional changes and appears out of scope.

Please clarify whether this version bump is intentional, part of a broader versioning strategy across multiple files, or should be removed from this PR.

components/booking_experts/actions/add-guest-to-reservation/add-guest-to-reservation.mjs (1)

7-7: Consider whether version bump is warranted without functional changes.

The version has been bumped from "0.0.4" to "0.0.5", but according to the enriched summary and the provided code, this action has no behavioral changes, error handling modifications, or control flow updates. Semantic versioning typically reserves patch version bumps for bug fixes or minor functional improvements.

If this is a systematic version bump across all related actions in the PR, this may be appropriate for consistency. However, if this action is unchanged while related actions are being enhanced, the version may remain at "0.0.4".

Could you clarify whether this version bump is intentional? Is this part of a systematic versioning strategy across all Booking Experts actions, or should it remain at "0.0.4" given no functional changes?

components/booking_experts/actions/create-agenda-period/create-agenda-period.mjs (1)

7-7: Clarify the rationale for the version bump.

This file has no functional changes—only a version increment from 0.0.4 to 0.0.5. Since the PR objectives focus on expanding availability filters (in list-availabilities and list-rentabletype-availabilities), it's unclear why this unrelated action should be versioned.

Is this a collateral bump across all Booking Experts actions, or should this change be excluded from the PR?

components/booking_experts/actions/search-contacts/search-contacts.mjs (1)

4-13: Version bump to 0.0.5 is appropriate and non-breaking

Patch version increment with no logic changes is consistent with current behavior; this action’s runtime behavior remains unchanged.

components/booking_experts/actions/delete-guest/delete-guest.mjs (1)

7-7: Clarify the rationale for the version bump without functional changes.

The version is incremented from 0.0.2 to 0.0.3, but the enriched summary notes that this action "does not incorporate these changes directly, it only reflects the version bump." This is inconsistent with semantic versioning, where a patch bump (0.0.2 → 0.0.3) should accompany a bug fix or compatible change, but the action has no functional modifications.

Either this is part of a coordinated versioning strategy across all Booking Experts actions (which should be documented), or the version bump should not be applied to actions without functional changes. Per the PR objectives, this PR is focused on expanding filters for availabilities; it's unclear whether delete-guest should be included.

components/booking_experts/actions/get-reservation/get-reservation.mjs (1)

7-7: Clarify version bump rationale.

The version is bumped from 0.0.1 to 0.0.2, but per the AI summary, there are no changes to logic, behavior, or control flow in this file. The PR objectives (#19270) specifically target expanding GET availabilities and GET rentable_type availabilities, not the get-reservation endpoint.

Is this version bump part of a coordinated release pattern across multiple actions, or should it be reverted if no functional changes are intended?

components/booking_experts/actions/update-guest/update-guest.mjs (1)

7-7: Version bump to 0.0.3 looks correct

This is a non-functional metadata update and is consistent with bumping action versions alongside broader Booking Experts changes.

components/booking_experts/actions/list-inventory-objects/list-inventory-objects.mjs (1)

7-7: Verify version bump aligns with PR scope and actual changes.

The version was bumped from 0.0.4 to 0.0.5, but the AI summary indicates "no changes to logic, arguments, or runtime behavior." Additionally, PR #19270 targets availability actions, not inventory objects. Clarify whether:

  1. This file is in scope for the PR (or if this version bump should be reverted)
  2. What substantive change warrants the version bump if no logic/args changed
components/booking_experts/sources/booking-updated/booking-updated.mjs (1)

8-8: Verify necessity of version bump.

The file contains only a version change (0.0.3 → 0.0.4) with no functional or logic modifications. Based on the AI summary, no behavior changes are present.

Confirm whether this version bump is necessary given that:

  1. This source handles booking updates, not availabilities (which are the focus of the PR).
  2. No usage of the new utilities (parseObject) or constants (FIELDS_OPTIONS, etc.) introduced in this PR appears in this file.

If this source doesn't directly consume the new capabilities being added in the PR, consider whether the version bump should be deferred or consolidated with other changes.

components/booking_experts/sources/new-inventory-object-created/new-inventory-object-created.mjs (1)

8-8: Verify the version bump rationale—no logic changes in this source.

The version is incremented from 0.0.3 to 0.0.4, but no functional changes, new features, or bug fixes are present in this source file. The PR's primary objective (expanding filters for availabilities) does not affect this source, and it does not use the new utilities or constants mentioned in the broader PR summary.

Semantic versioning typically ties version increments to actual changes. If this is a blanket version bump across the integration, clarify the rationale. If it was unintentional, consider reverting it.

components/booking_experts/actions/get-booking/get-booking.mjs (1)

7-7: Clarify the rationale for this version bump.

This file shows only a version bump without any functional changes to logic, props, or API calls. The PR objectives focus on expanding filters for GET availabilities and GET rentable_type availabilities endpoints, which are unrelated to the "Get Booking" action.

Verify whether:

  • This version bump is part of a coordinated versioning strategy across all actions in the PR
  • This action requires updates to use new utilities or constants introduced in the PR
  • This file should be included in this PR at all, or if it was inadvertently modified
components/booking_experts/actions/list-bookings/list-bookings.mjs (1)

7-7: Version bump-only change looks consistent

The version bump to "0.0.5" is consistent with the PR pattern of bumping Booking Experts action versions and does not introduce behavioral changes in this file.

components/booking_experts/actions/list-reservations/list-reservations.mjs (1)

7-7: No version bump exists in this file within the current PR.

The version field (line 7) shows "0.0.2", which was already set in a previous commit. Git diff returns no changes for this file, confirming it was not modified in the current PR. The review comment's claim that the version was "bumped from '0.0.1' to '0.0.2'" is incorrect—no version change occurred in this PR for this file.

While the commit message references updating version numbers for booking experts actions, the list-reservations action was not part of the current diff under review.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (2)
components/booking_experts/actions/list-availabilities/list-availabilities.mjs (2)

27-32: Missing options for fields prop.

Unlike list-rentabletype-availabilities.mjs which uses FIELDS_OPTIONS, this prop has no options defined. Consider adding FIELDS_OPTIONS to provide a consistent user experience with selectable field values.


156-177: discountCampaignId and inventoryObjectId reference non-existent administrationId prop.

The prop definitions reference c.administrationId, but this action only has administrationIds (plural, array type) defined at lines 104-113. The callbacks will receive undefined, causing the dropdown options to fail loading.

Consider one of these approaches:

  1. Add a singular administrationId prop for these dependent fields
  2. Change the dependency to use the first element of administrationIds:
    discountCampaignId: {
      propDefinition: [
        bookingExperts,
        "discountCampaignId",
        (c) => ({
-          administrationId: c.administrationId,
+          administrationId: c.administrationIds?.[0],
        }),
      ],
      description: "Filter on discount campaign ID.",
      optional: true,
    },
    inventoryObjectId: {
      propDefinition: [
        bookingExperts,
        "inventoryObjectId",
        (c) => ({
-          administrationId: c.administrationId,
+          administrationId: c.administrationIds?.[0],
        }),
      ],
      description: "Filter on inventory object ID.",
      optional: true,
    },

Note: Option 2 may not provide the best UX since it only considers the first administration.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9f6c1d8 and 8164387.

📒 Files selected for processing (2)
  • components/booking_experts/actions/list-availabilities/list-availabilities.mjs (2 hunks)
  • components/booking_experts/actions/list-rentabletype-availabilities/list-rentabletype-availabilities.mjs (3 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-12T07:49:36.125Z
Learnt from: matyascimbulka
Repo: PipedreamHQ/pipedream PR: 18308
File: components/apify/actions/run-task-synchronously/run-task-synchronously.mjs:70-0
Timestamp: 2025-09-12T07:49:36.125Z
Learning: The Apify Task object always contains the `options` field according to the official API documentation, making nested destructuring like `options: { build }` safe to use without additional checks.

Applied to files:

  • components/booking_experts/actions/list-availabilities/list-availabilities.mjs
📚 Learning: 2025-09-11T01:53:51.070Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18334
File: components/buddee/actions/list-employees/list-employees.mjs:147-155
Timestamp: 2025-09-11T01:53:51.070Z
Learning: In Buddee list-employees action, the "manager" prop should be a boolean type to filter employees who have direct reports, not an employeeId propDefinition which would send an employee ID instead of the expected boolean value.

Applied to files:

  • components/booking_experts/actions/list-availabilities/list-availabilities.mjs
🧬 Code graph analysis (1)
components/booking_experts/actions/list-availabilities/list-availabilities.mjs (2)
components/booking_experts/common/constants.mjs (6)
  • WEEKDAY_OPTIONS (80-109)
  • WEEKDAY_OPTIONS (80-109)
  • SORTERS_OPTIONS (37-78)
  • SORTERS_OPTIONS (37-78)
  • LIMITERS_OPTIONS (14-35)
  • LIMITERS_OPTIONS (14-35)
components/booking_experts/common/utils.mjs (2)
  • parseObject (1-24)
  • parseObject (1-24)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (2)
components/booking_experts/actions/list-availabilities/list-availabilities.mjs (1)

49-54: Previously flagged issues have been fixed.

Good work addressing the past review feedback:

  • includeSemanticSegmentCounts is now properly defined as a prop (lines 49-54)
  • wday parsing now safely handles undefined values with a conditional check (lines 484-486)

Also applies to: 484-486

components/booking_experts/actions/list-rentabletype-availabilities/list-rentabletype-availabilities.mjs (1)

10-10: Version bump to 0.0.3 is appropriate for the expanded public props

Given the new public inputs (fields, include, multibookSafetyMargin) and behavior changes, incrementing the action version to 0.0.3 is a reasonable, backwards‑compatible update.

Copy link
Collaborator

@jcortes jcortes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @luancazarine it is looking good! However please fix conflicts first!

…types

- Introduced new fields for filtering availabilities and rentable types, including `fields`, `include`, and `multibookSafetyMargin`.
- Added methods for listing rentable segments, amenities, and discount campaigns in the booking experts app.
- Updated version numbers for actions related to availabilities and rentable type availabilities.
- Created constants for fields, limiters, sorters, and weekdays to enhance filtering capabilities.
@jcortes jcortes force-pushed the 19270-action-booking-experts---expand-filters branch from 8164387 to a3f5d2f Compare December 4, 2025 18:10
…k safety margin naming in availabilities actions

- Introduced `includeSemanticSegmentCounts` option to enhance metadata results.
- Renamed `multibookSsafetyMargin` to `multibookSafetyMargin` for consistency in rentable type availabilities.
- Updated parsing logic for `wday` filter to handle undefined values correctly.
@jcortes jcortes force-pushed the 19270-action-booking-experts---expand-filters branch from a3f5d2f to eb06345 Compare December 4, 2025 18:14
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (8)
components/booking_experts/actions/get-complex-prices/get-complex-prices.mjs (1)

7-7: LGTM!

Version bump is consistent with the package version update to 0.4.0. The coordinated version bumps across all actions address the previously noted version inconsistency concern.

components/booking_experts/actions/list-rentabletype-availabilities/list-rentabletype-availabilities.mjs (2)

52-64: Conditionally include fields and include params to avoid undefined or empty values.

The props are well-defined, but parseObject(this.fields)?.join(",") at line 85 and parseObject(this.include)?.join(",") at line 86 may produce undefined or empty strings. Consider only adding these params when there's at least one value to keep the wire format clean and align with the existing date_range handling pattern.

Apply this pattern:

   async run({ $ }) {
     if ((!this.startDate && this.endDate) || (this.startDate && !this.endDate)) {
       throw new ConfigurationError("You should provide both the start and end date parameters.");
     }
+
+    const fields = parseObject(this.fields);
+    const includes = parseObject(this.include);
+
     const { data } = await this.bookingExperts.listRentableTypeAvailabilities({
       $,
       channelId: this.channelId,
       rentableTypeId: this.rentableTypeId,
       params: {
         ...(this.startDate && this.endDate && {
           "date_range": `${this.startDate}..${this.endDate}`,
         }),
-        "fields[rentable_type_availability]": parseObject(this.fields)?.join(","),
-        "include": parseObject(this.include)?.join(","),
-        "multibook_safety_margin": this.multibookSafetyMargin,
+        ...(fields?.length && {
+          "fields[rentable_type_availability]": fields.join(","),
+        }),
+        ...(includes?.length && {
+          "include": includes.join(","),
+        }),
+        ...(this.multibookSafetyMargin != null && {
+          "multibook_safety_margin": this.multibookSafetyMargin,
+        }),
       },
     });

65-70: Enforce "positive number" constraint for multibookSafetyMargin.

The description states the safety margin "must be a positive number", but the prop accepts any integer including 0 or negative values. Consider adding validation to fail early with a clearer error message, similar to the start/end date validation.

Add this validation in the run method:

   async run({ $ }) {
     if ((!this.startDate && this.endDate) || (this.startDate && !this.endDate)) {
       throw new ConfigurationError("You should provide both the start and end date parameters.");
     }
+
+    if (this.multibookSafetyMargin != null && this.multibookSafetyMargin <= 0) {
+      throw new ConfigurationError("Multi-book Safety Margin must be a positive integer when provided.");
+    }
components/booking_experts/booking_experts.app.mjs (3)

250-267: Potential runtime error if attributes.name is null/undefined.

Line 263 accesses attributes.name.en which will throw if name is null or undefined. Add defensive access with a fallback.

Apply this diff:

         return data?.map(({
           id, attributes,
         }) => ({
-          label: attributes.name.en,
+          label: attributes.name?.en ?? attributes.name ?? id,
           value: id,
         })) || [];

268-285: Same defensive access pattern needed for amenityId.

Line 281 has the same unsafe access pattern as rentableSegmentId. Apply null-safe access.

Apply this diff:

         return data?.map(({
           id, attributes,
         }) => ({
-          label: attributes.name.en,
+          label: attributes.name?.en ?? attributes.name ?? id,
           value: id,
         })) || [];

286-307: Same defensive access pattern needed for discountCampaignId.

Line 303 has the same unsafe access pattern. Apply null-safe access with a fallback.

Apply this diff:

         return data?.map(({
           id, attributes,
         }) => ({
-          label: attributes.name.en,
+          label: attributes.name?.en ?? attributes.name ?? id,
           value: id,
         })) || [];
components/booking_experts/actions/list-availabilities/list-availabilities.mjs (2)

27-32: Consider adding FIELDS_OPTIONS for consistency.

Unlike list-rentabletype-availabilities.mjs which provides field options, this prop has none. Adding options: FIELDS_OPTIONS would provide a consistent UX with selectable values.

Import and add options:

 import {
+  FIELDS_OPTIONS,
   LIMITERS_OPTIONS,
   SORTERS_OPTIONS,
   WEEKDAY_OPTIONS,
 } from "../../common/constants.mjs";
     fields: {
       type: "string[]",
       label: "Fields",
       description: "Fieldset of attributes to return. [See the documentation](https://developers.bookingexperts.com/reference/availabilities-index)",
+      options: FIELDS_OPTIONS,
       optional: true,
     },

156-177: discountCampaignId and inventoryObjectId reference non-existent administrationId prop.

Lines 161 and 172 reference c.administrationId, but this action only defines administrationIds (plural, array type). The options callbacks will receive undefined, preventing the dropdowns from loading.

Consider using the first element of the array:

     discountCampaignId: {
       propDefinition: [
         bookingExperts,
         "discountCampaignId",
         (c) => ({
-          administrationId: c.administrationId,
+          administrationId: c.administrationIds?.[0],
         }),
       ],
       description: "Filter on discount campaign ID.",
       optional: true,
     },
     inventoryObjectId: {
       propDefinition: [
         bookingExperts,
         "inventoryObjectId",
         (c) => ({
-          administrationId: c.administrationId,
+          administrationId: c.administrationIds?.[0],
         }),
       ],
       description: "Filter on inventory object ID.",
       optional: true,
     },

Note: This uses only the first administration ID, which may not provide ideal UX if multiple are selected.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8164387 and eb06345.

📒 Files selected for processing (21)
  • components/booking_experts/actions/add-guest-to-reservation/add-guest-to-reservation.mjs (1 hunks)
  • components/booking_experts/actions/create-agenda-period/create-agenda-period.mjs (1 hunks)
  • components/booking_experts/actions/delete-guest/delete-guest.mjs (1 hunks)
  • components/booking_experts/actions/get-booking/get-booking.mjs (1 hunks)
  • components/booking_experts/actions/get-complex-prices/get-complex-prices.mjs (1 hunks)
  • components/booking_experts/actions/get-reservation/get-reservation.mjs (1 hunks)
  • components/booking_experts/actions/list-availabilities/list-availabilities.mjs (2 hunks)
  • components/booking_experts/actions/list-bookings/list-bookings.mjs (1 hunks)
  • components/booking_experts/actions/list-inventory-objects/list-inventory-objects.mjs (1 hunks)
  • components/booking_experts/actions/list-rentabletype-availabilities/list-rentabletype-availabilities.mjs (3 hunks)
  • components/booking_experts/actions/list-reservations/list-reservations.mjs (1 hunks)
  • components/booking_experts/actions/search-contacts/search-contacts.mjs (1 hunks)
  • components/booking_experts/actions/update-guest/update-guest.mjs (1 hunks)
  • components/booking_experts/booking_experts.app.mjs (2 hunks)
  • components/booking_experts/common/constants.mjs (1 hunks)
  • components/booking_experts/common/utils.mjs (1 hunks)
  • components/booking_experts/package.json (1 hunks)
  • components/booking_experts/sources/booking-updated/booking-updated.mjs (1 hunks)
  • components/booking_experts/sources/inventory-object-updated/inventory-object-updated.mjs (1 hunks)
  • components/booking_experts/sources/new-booking-created/new-booking-created.mjs (1 hunks)
  • components/booking_experts/sources/new-inventory-object-created/new-inventory-object-created.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2024-10-08T16:42:59.225Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 14229
File: components/americommerce/actions/update-customer/update-customer.mjs:89-94
Timestamp: 2024-10-08T16:42:59.225Z
Learning: When defining boolean properties in AmeriCommerce components (e.g., in `update-customer.mjs`), ensure that the label and description are consistent and clearly indicate the intent, especially when using negations like "No Account", to avoid confusion.

Applied to files:

  • components/booking_experts/booking_experts.app.mjs
📚 Learning: 2025-08-27T17:25:10.425Z
Learnt from: jverce
Repo: PipedreamHQ/pipedream PR: 18187
File: packages/connect-react/src/utils/type-guards.ts:23-33
Timestamp: 2025-08-27T17:25:10.425Z
Learning: In the connect-react package, the isOptionWithLabel type guard intentionally restricts value types to string|number for runtime filtering purposes, even though LabelValueOption<T> allows any T. This runtime behavior should be preserved over type safety improvements.

Applied to files:

  • components/booking_experts/booking_experts.app.mjs
📚 Learning: 2025-09-12T07:49:36.125Z
Learnt from: matyascimbulka
Repo: PipedreamHQ/pipedream PR: 18308
File: components/apify/actions/run-task-synchronously/run-task-synchronously.mjs:70-0
Timestamp: 2025-09-12T07:49:36.125Z
Learning: The Apify Task object always contains the `options` field according to the official API documentation, making nested destructuring like `options: { build }` safe to use without additional checks.

Applied to files:

  • components/booking_experts/actions/list-availabilities/list-availabilities.mjs
📚 Learning: 2025-09-11T01:53:51.070Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18334
File: components/buddee/actions/list-employees/list-employees.mjs:147-155
Timestamp: 2025-09-11T01:53:51.070Z
Learning: In Buddee list-employees action, the "manager" prop should be a boolean type to filter employees who have direct reports, not an employeeId propDefinition which would send an employee ID instead of the expected boolean value.

Applied to files:

  • components/booking_experts/actions/list-availabilities/list-availabilities.mjs
🧬 Code graph analysis (3)
components/booking_experts/common/utils.mjs (2)
components/booking_experts/actions/list-availabilities/list-availabilities.mjs (1)
  • parseObject (470-544)
components/booking_experts/actions/list-rentabletype-availabilities/list-rentabletype-availabilities.mjs (1)
  • parseObject (76-89)
components/booking_experts/actions/list-rentabletype-availabilities/list-rentabletype-availabilities.mjs (3)
components/booking_experts/common/constants.mjs (2)
  • FIELDS_OPTIONS (1-12)
  • FIELDS_OPTIONS (1-12)
components/booking_experts/actions/list-availabilities/list-availabilities.mjs (1)
  • parseObject (470-544)
components/booking_experts/common/utils.mjs (2)
  • parseObject (1-24)
  • parseObject (1-24)
components/booking_experts/actions/list-availabilities/list-availabilities.mjs (2)
components/booking_experts/common/constants.mjs (6)
  • WEEKDAY_OPTIONS (80-109)
  • WEEKDAY_OPTIONS (80-109)
  • SORTERS_OPTIONS (37-78)
  • SORTERS_OPTIONS (37-78)
  • LIMITERS_OPTIONS (14-35)
  • LIMITERS_OPTIONS (14-35)
components/booking_experts/common/utils.mjs (2)
  • parseObject (1-24)
  • parseObject (1-24)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Lint Code Base
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (16)
components/booking_experts/actions/add-guest-to-reservation/add-guest-to-reservation.mjs (1)

8-8: Version bump to 0.0.7 looks appropriate

Metadata-only change; no behavioral differences introduced here. Patch bump is consistent with a non-breaking update elsewhere in the Booking Experts components.

components/booking_experts/actions/create-agenda-period/create-agenda-period.mjs (1)

7-7: Verify the version bump is aligned with PR scope.

This action appears unrelated to the PR objectives (expanding filters for availabilities endpoints). While the version bump may be part of a broad package-wide update, please confirm that this change is intentional and necessary for this PR, or whether it should be reserved for a separate versioning commit.

components/booking_experts/sources/new-inventory-object-created/new-inventory-object-created.mjs (2)

8-8: Verify version bump is intentional and coordinated.

Line 8 bumps the version from "0.0.4" to "0.0.5", but the source logic itself has no functional changes. The PR objectives focus on expanding availability filters, not inventory object sources.

Confirm that:

  • This version bump is part of a coordinated module-level release (not a stray change)
  • Other related files in this PR have corresponding updates

Since I do not have visibility into all files modified in this PR, please verify that this version bump aligns with the broader changes and is not unintended.


1-40: Source structure and logic look correct.

No functional issues detected. The source correctly inherits from the polling base, defines the inventory object resource, and generates appropriate metadata. If the version bump is justified as a coordinated module update, this change is safe to merge.

components/booking_experts/actions/get-reservation/get-reservation.mjs (1)

7-7: Verify whether the version bump is necessary without functional changes.

Line 7 bumps the version from 0.0.2 to 0.0.3, but there are no functional changes to this action in the provided diff. Version bumps should reflect actual changes.

  • Is this version bump part of a broader component package version update that applies to all actions?
  • If yes, clarify this in the commit message or PR description for context.
  • If this action had no changes, consider reverting the version to the original.
components/booking_experts/actions/list-reservations/list-reservations.mjs (1)

7-7: This is a new file being created, not a modified file with a version bump.

The version "0.0.3" is the initial version for this newly created action file, not a bump from "0.0.2". The git diff shows list-reservations.mjs as a new file (new file mode 100644), which means it did not exist in the repository before this commit and all concerns about unjustified version bumping are invalid.

Likely an incorrect or invalid review comment.

components/booking_experts/sources/inventory-object-updated/inventory-object-updated.mjs (1)

8-8: LGTM!

Version bump is consistent with the package version update to 0.4.0.

components/booking_experts/actions/get-booking/get-booking.mjs (1)

7-7: LGTM!

Version bump is consistent with the package version update to 0.4.0.

components/booking_experts/actions/delete-guest/delete-guest.mjs (1)

7-7: LGTM!

Version bump is consistent with the package version update to 0.4.0.

components/booking_experts/actions/list-inventory-objects/list-inventory-objects.mjs (1)

7-7: LGTM!

Version bump is consistent with the package version update to 0.4.0.

components/booking_experts/common/constants.mjs (1)

1-109: LGTM! Well-structured constants for API parameters.

The constants are well-organized and follow consistent patterns:

  • FIELDS_OPTIONS provides valid field names in snake_case
  • LIMITERS_OPTIONS and SORTERS_OPTIONS use descriptive labels with matching API values
  • WEEKDAY_OPTIONS uses standard Sunday=0 convention with string values
components/booking_experts/actions/list-rentabletype-availabilities/list-rentabletype-availabilities.mjs (2)

3-4: LGTM!

The imports are correctly added to support the new filtering functionality.


10-10: LGTM!

Version bump is appropriate for the added filtering functionality.

components/booking_experts/booking_experts.app.mjs (1)

495-514: LGTM!

The new API methods are correctly implemented and follow the established patterns in the codebase.

components/booking_experts/actions/list-availabilities/list-availabilities.mjs (2)

2-7: LGTM!

The imports are correctly added to support the comprehensive filtering, sorting, and limiting functionality.


484-486: LGTM!

The conditional parsing of wday correctly prevents NaN values from being passed to the API. This addresses the previous concern about unsafe parsing.

@vunguyenhung
Copy link
Collaborator

Hi everyone, all test cases are passed! Ready for release!

Test reports

@jcortes jcortes self-requested a review December 5, 2025 15:50
@jcortes jcortes merged commit 0450db2 into master Dec 5, 2025
10 checks passed
@jcortes jcortes deleted the 19270-action-booking-experts---expand-filters branch December 5, 2025 15:50
jcortes pushed a commit that referenced this pull request Dec 9, 2025
#19317)

* Add new fields and filtering options for availabilities and rentable types

- Introduced new fields for filtering availabilities and rentable types, including `fields`, `include`, and `multibookSafetyMargin`.
- Added methods for listing rentable segments, amenities, and discount campaigns in the booking experts app.
- Updated version numbers for actions related to availabilities and rentable type availabilities.
- Created constants for fields, limiters, sorters, and weekdays to enhance filtering capabilities.

* Update version number for @pipedream/booking_experts to 0.4.0

* Add new option for including semantic segment counts and fix multibook safety margin naming in availabilities actions

- Introduced `includeSemanticSegmentCounts` option to enhance metadata results.
- Renamed `multibookSsafetyMargin` to `multibookSafetyMargin` for consistency in rentable type availabilities.
- Updated parsing logic for `wday` filter to handle undefined values correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ACTION] Booking Experts - expand filters

4 participants